home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Gfx
/
show
/
WallpaperView.lha
/
WallpaperViewer.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2004-08-09
|
5KB
|
162 lines
/*
WallpaperViewer by Mario (AMario@wp.pl)
Do not publish modyfied code!
$VER: WallpaperViewer 1.2
*/
signal on halt
signal on break_c
call init
call createApp
call handleApp
/***********************************************************************/
init: procedure
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
if AddLibrary("rexxsupport.library","rxmui.library","rxwb.library")~=0 then exit
call ProgDir()
return
/***********************************************************************/
handleApp: procedure
ctrl_c=2**12
s=0
do forever
call handle("APP","H",s)
do i=0 to h.num-1
if h.i="QUIT" then exit
interpret h.i
end
call getattr("win","title","nazwaold")
if SelectedIcon()~=nazwaold then call Refreshnij
if and(s,ctrl_c)~=0 then exit
call delay(1)
end
return
/***********************************************************************/
createApp: procedure
app.Title="WallpaperViewer"
app.Description="Views and installs wallpapers"
app.Base="WALLPAPERV"
app.SubWindow="win"
win.ID="MAIN"
win.Title="WallpaperViewer"
win.HelpNode="Window"
win.Contents="group"
group.0=text("status"," Select icon in WB... ")
group.1=button("su","_Screen (use)")
group.2=button("ss","S_creen (save)")
group.3=button("wu","_Window (use)")
group.4=button("ws","W_indow (save)")
group.5="cyc"
cyc.class="cycle"
cyc.entries="Small view|Big view|Wallpaper!|Freeze view"
cyc.activeentry="Small view"
group.6="pic"
pic.class="gfxpic"
pic.transparent=1
call NewObj("Application","app")
call Notify("win","CloseRequest",1,"app","ReturnID","quit")
call Notify("su","Pressed",0,"app","Return","call SUse")
call Notify("ss","Pressed",0,"app","Return","call SSave")
call Notify("wu","Pressed",0,"app","Return","call WUse")
call Notify("ws","Pressed",0,"app","Return","call WSave")
call set("win","Open",1)
return
/***********************************************************************/
Refreshnij: procedure
call getattr("cyc","activeentry","tryb")
if tryb="Freeze view" then return
call getattr("win","title","nazwa")
if nazwa="WallpaperViewer" then return
call domethod("group",initchange)
call set("status","contents"," Loading... ")
call domethod("group",exitchange)
call domethod("group",initchange)
call set("pic","source",nazwa)
call getattr("pic","imagewidth","szer")
call getattr("pic","imageheight","wys")
if szer<450 & tryb="Big view" & szer>14 then
do
proc=45000%szer
call set("pic","scale",proc)
end
if szer>500 & tryb="Big view" then
do
proc=50000%szer
call set("pic","scale",proc)
end
if szer>280 & tryb="Small view" then
do
proc=28000%szer
call set("pic","scale",proc)
end
if tryb="Wallpaper!" & szer>1 then
do
proc=15000%szer
call set("pic","scale",proc)
end
if szer>0 then
do
call domethod("win","ScreenInfo","ekran")
call getattr("pic","scaledheight","swys")
if ((ekran.height-160)<swys)|(szer>100*wys ) then
do
call set("pic","source","")
call set("status","contents"," Too large picture... ")
call domethod("group",exitchange)
return
end
call set("status","contents", szer "x" wys", Ready... ")
end
if szer=0 then call set("status","contents"," Select icon in WB... ")
if szer>149 & tryb="Wallpaper!" then call sUse
call domethod("group",exitchange)
return
/***********************************************************************/
SelectedIcon: procedure
call WBGetAttr('',"SELECTEDICONLIST","stem")
if stem.num>0 then nazwa=stem.0
if stem.num=0 then call getattr("win","title","nazwa")
if nazwa="STEM.0" then call getattr("win","title","nazwa")
call set("win","title",nazwa)
return nazwa
/***********************************************************************/
halt:
break_c:
exit
/***********************************************************************/
SUse: procedure
call getattr("win","title","nazwa")
if nazwa="WallpaperViewer" then return
call getattr("pic","imagewidth","szer")
if szer<150 then return
address command 'C:NewWBPattern "'nazwa'"'
return
/***********************************************************************/
SSave: procedure
call getattr("win","title","nazwa")
if nazwa="WallpaperViewer" then return
call getattr("pic","imagewidth","szer")
if szer<150 then return
address command 'C:NewWBPattern "'nazwa'" save'
return
/***********************************************************************/
WUse: procedure
call getattr("win","title","nazwa")
if nazwa="WallpaperViewer" then return
address command 'C:NewWBPattern windows "'nazwa'"'
return
/***********************************************************************/
WSave: procedure
call getattr("win","title","nazwa")
if nazwa="WallpaperViewer" then return
address command 'C:NewWBPattern windows "'nazwa'" save'
return
/***********************************************************************/